package com.alliky.core.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.rrc.common.entity.RemoteKey

/**
 * ================================================
 * @Description: 描述
 * @Author: wxianing
 * @Date: 2022/11/24 17:48
 * ================================================
 */
@Dao
interface RemoteKeyDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(keys: RemoteKey)

    @Query("SELECT * FROM RemoteKey WHERE subreddit = :subreddit")
    suspend fun remoteKeyByPost(subreddit: String): RemoteKey

    @Query("DELETE FROM RemoteKey WHERE subreddit = :subreddit")
    suspend fun deleteBySubreddit(subreddit: String)
}